/*
 * @Description:
 * @Date: 2024-07-03 08:52:57
 * @LastEditTime: 2024-07-09 14:40:51
 */
import request from '@/config/axios'

export interface ReportVO {
  id?: number
  status?: number
  type?: string
  content?: string
  title?: string
  gridId?: number
  userId?: number
  result?: string
  rating?: number
  evaluate?: string
  author?: string
  stick?: boolean
  largeScreen?: boolean
}

// 查询村情上报列表
export const getReportPage = async (params) => {
  return await request.get({ url: '/countryside/disclosure-affairs/page', params })
}

// 查询村情上报详情
export const getReport = async (id: number) => {
  return await request.get({ url: '/countryside/disclosure-affairs/get?id=' + id })
}

// 新增村情上报
export const createReport = async (data: ReportVO) => {
  return await request.post({ url: '/countryside/disclosure-affairs/create', data })
}

// 修改村情上报
export const updateReport = async (data: ReportVO) => {
  return await request.put({ url: '/countryside/disclosure-affairs/update', data })
}

// 删除村情上报
export const deleteReport = async (id: number) => {
  return await request.delete({ url: '/countryside/disclosure-affairs/delete?id=' + id })
}

// 导出村情上报 Excel
export const exportReportApi = async (params) => {
  return await request.download({ url: '/countryside/report/export-excel', params })
}

//置顶
export const updateStick = async (id: number, stick: boolean) => {
  return await request.put({ url: `/countryside/disclosure-affairs/stick?id=${id}&stick=${stick}` })
}
export const updateDisplay = async (id: number, display: boolean) => {
  return await request.put({
    url: `/countryside/disclosure-affairs/display?id=${id}&display=${display}`
  })
}
